package com.leo;

import atlantafx.base.theme.PrimerDark;
import com.almasb.fxgl.app.GameApplication;
import com.almasb.fxgl.app.GameSettings;
import com.almasb.fxgl.app.scene.FXGLMenu;
import com.almasb.fxgl.app.scene.LoadingScene;
import com.almasb.fxgl.app.scene.SceneFactory;
import com.almasb.fxgl.app.scene.StartupScene;
import com.almasb.fxgl.dsl.FXGL;
import com.leo.entity.BorderEntityFactory;
import com.leo.ui.ClientLoadingScene;
import com.leo.ui.ClientStartupScene;
import javafx.application.Application;
import org.jetbrains.annotations.NotNull;

public class ClientApplication extends GameApplication {
    @Override
    protected void initSettings(GameSettings settings) {
        settings.setWidth(1200);
        settings.setHeight(700);
        settings.setTitle("使用FXGL开发客户端");
        settings.setAppIcon("ui/logo.png");
        settings.setManualResizeEnabled(true);
        settings.setMainMenuEnabled(true);
        settings.setGameMenuEnabled(false);
        settings.setSceneFactory(new SceneFactory() {
            @NotNull
            @Override
            public LoadingScene newLoadingScene() {
                return new ClientLoadingScene();
            }

            @NotNull
            @Override
            public FXGLMenu newMainMenu() {
//                return new ClientMainMenu(MenuType.MAIN_MENU);
                return super.newMainMenu();
            }

            @NotNull
            @Override
            public StartupScene newStartup(int width, int height) {
                return new ClientStartupScene(800, 700);
            }
        });
    }

    @Override
    protected void initGame() {
        Application.setUserAgentStylesheet(new PrimerDark().getUserAgentStylesheet());
        FXGL.getGameWorld().addEntityFactory(new BorderEntityFactory());
        FXGL.spawn("borderPane");
    }

    @Override
    protected void initUI() {
        super.initUI();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
